package utils

import (
	"time"
)

// 按天生成日期数据
func GenerateDayList(startDate, endDate time.Time) []string {
	dateList := []string{}
	currentDate := startDate

	for !currentDate.After(endDate) {
		dateList = append(dateList, currentDate.Format("2006-01-02"))

		// 增加一天
		currentDate = currentDate.AddDate(0, 0, 1)
	}

	return dateList
}

// 按月生成日期数据
func GenerateMonthList(startDate, endDate time.Time) []string {
	dateList := []string{}
	currentDate := startDate

	for !currentDate.After(endDate) {
		dateList = append(dateList, currentDate.Format("2006-01"))

		// 增加一个月
		currentDate = currentDate.AddDate(0, 1, 0)
	}

	return dateList
}
